package base.多线程.扩展JUC;

public class Th1 implements Runnable{
    volatile int count = 0;
    @Override
    public void run() {
        count = 1;
        System.out.println("count="+count);
        try {
            Thread.sleep(100000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
}
class Text {
    public static void main(String[] args) throws InterruptedException {
        Th1 th1 = new Th1();
        Thread t1 = new Thread(th1);
        t1.start();

        for (int i = 0; i < 20; i++) {
            System.out.println("main线程="+th1.count);
            if (i == 10){
                Thread.sleep(10);
            }
        }
    }
}
